/*    */ package com.controller.back;
/*    */ 
/*    */ import base.utils.PagingResult;
/*    */ import com.model.Admin;
/*    */ import com.model.Contact;
/*    */ import com.service.ContactService;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpSession;
/*    */ import org.springframework.beans.factory.annotation.Autowired;
/*    */ import org.springframework.stereotype.Controller;
/*    */ import org.springframework.web.bind.annotation.RequestMapping;
/*    */ import org.springframework.web.servlet.ModelAndView;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ @Controller
/*    */ @RequestMapping({"adminContact"})
/*    */ public class AdminContactController
/*    */ {
/*    */   @Autowired
/*    */   private ContactService contactService;
/*    */   
/*    */   @RequestMapping({"index"})
/*    */   public ModelAndView getContactList(HttpServletRequest request)
/*    */   {
/* 36 */     ModelAndView mv = new ModelAndView();
/*    */     
/*    */ 
/* 39 */     String page = (request.getParameter("page") == null) || 
/* 40 */       ("".equals(request.getParameter("page"))) ? "1" : request
/* 41 */       .getParameter("page");
/* 42 */     String size = (request.getParameter("size") == null) || 
/* 43 */       ("".equals(request.getParameter("size"))) ? "20" : request
/* 44 */       .getParameter("size");
/*    */     
/* 46 */     HttpSession session = request.getSession();
/* 47 */     Admin t = (Admin)session.getAttribute("admin_user");
/* 48 */     if (t == null) {
/* 49 */       mv.setViewName("redirect:/manage/managelogin.do");
/* 50 */       return mv;
/*    */     }
/*    */     
/* 53 */     String[] clause = new String[0];
/* 54 */     String sql = " WHERE deleteFlag=0 ";
/* 55 */     Object[] obj = new Object[0];
/* 56 */     PagingResult pr = this.contactService.selectBySqlPaging(clause, sql, obj, Integer.valueOf(Integer.parseInt(page)), Integer.valueOf(Integer.parseInt(size)));
/* 57 */     List<Map<?, ?>> list = pr.getResultList();
/* 58 */     int h = (Integer.parseInt(page) - 1) * Integer.parseInt(size);
/* 59 */     mv.addObject("ss", Integer.valueOf(h));
/* 60 */     mv.addObject("list", list);
/* 61 */     mv.addObject("size", size);
/* 62 */     mv.addObject("page", page);
/* 63 */     mv.addObject("total", Integer.valueOf(pr.getTotalSize()));
/* 64 */     mv.addObject("url", "/back/contact/index.jsp");
/* 65 */     mv.setViewName("/index.jsp");
/* 66 */     return mv;
/*    */   }
/*    */   
/*    */   @RequestMapping({"show"})
/*    */   public ModelAndView show(HttpServletRequest request)
/*    */   {
/* 72 */     ModelAndView mv = new ModelAndView();
/* 73 */     String contact_id = request.getParameter("contact_id");
/*    */     
/* 75 */     Contact contact = (Contact)this.contactService.selectByPrimaryKey(contact_id);
/*    */     
/*    */ 
/*    */ 
/* 79 */     mv.addObject("contact", contact);
/* 80 */     mv.addObject("url", "/back/contact/show.jsp");
/* 81 */     mv.setViewName("/index.jsp");
/* 82 */     return mv;
/*    */   }
/*    */ }


/* Location:              C:\Users\chengkp\Desktop\interwar\WEB-INF\classes\!\com\controller\back\AdminContactController.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */